//
//  expertLeftViewController.m
//  ILiangCang
//
//  Created by ZX on 16-4-14.
//  Copyright (c) 2016年 CRQ. All rights reserved.
//

#import "expertLeftViewController.h"
#import "leftViewCell.h"
#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
@interface expertLeftViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@property(nonatomic,strong)UITableView * tableView;
@property(nonatomic,strong)NSArray * dataArray;
@end

@implementation expertLeftViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor blackColor];
    self.dataArray = @[@"默认推荐",@"最多推荐",@"最受欢迎",@"最新加入",@"最新推荐"];
    
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(-15, 64, WIDTH, HEIGHT-64)];
    [_tableView registerClass:[leftViewCell class] forCellReuseIdentifier:@"cell"];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = [UIColor colorWithRed:50.0/255 green:50.0/255 blue:50.0/255 alpha:1];
    _tableView.rowHeight = 40;
    [self.view addSubview:_tableView];
    
    UISearchBar * search = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 20, 260, 44)];
    
    search.backgroundColor =[UIColor colorWithRed:50.0/255 green:50.0/255 blue:50.0/255 alpha:1];
    [search setPlaceholder:@"搜索"];
    [search setSearchBarStyle:UISearchBarStyleMinimal];
    [self.view addSubview:search];
    
    UITapGestureRecognizer *tableViewGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(commentTableViewTouchInSide)];
    tableViewGesture.numberOfTapsRequired = 1;
    tableViewGesture.cancelsTouchesInView = NO;
    [_tableView addGestureRecognizer:tableViewGesture];
    
    
    
    
    
}



-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _dataArray.count;
}

-(UITableViewCell * )tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    leftViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.bg.image = [UIImage imageNamed:@"cell_seper"];
    cell.title.text = _dataArray[indexPath.row];
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_round"]] ;
    cell.selectedBackgroundView.frame = CGRectMake(0, 0, WIDTH, 40);
    cell.selectedBackgroundView.alpha = 0.2;
    

    
    return cell;
    
}




- (void)commentTableViewTouchInSide{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
